package org.example;

import org.example.bean.Book;
import org.example.bean.Position;
import org.example.service.BookService;
import org.example.service.PositionService;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;

import java.util.List;

@SpringBootApplication
public class SolrApplication {

    public static void main(String[] args) {
        ApplicationContext app = SpringApplication.run(SolrApplication.class, args);
//        BookService bookService = app.getBean("bookService",BookService.class);
////        Book book  = new Book("71","ES","ES就是ElasticSearch",911.5);
////        bookService.addBook(book);
//        List<Book> books = bookService.queryBooks("name:Ela*");
//        System.out.println(books);
        
        PositionService positionService = app.getBean("positionService",PositionService.class);
//        Position position = new Position("10111", "老铁公司", "宣传委员", "12-20k");
//        positionService.addPosition(position);

//        List<Position> positions = positionService.queryPositions("positionName:工程师");
        List<Position> positions = positionService.queryPositions("positionName:宣传委员");
        for (Position position : positions) {
            System.out.println(position);
        }
    }
}
